import React from 'react';
import { connect } from 'dva'
import { Icon, List, WhiteSpace, Button,Stepper } from 'antd-mobile';
import { routerRedux } from 'dva/router';
import bannera from '../../../assets/work/banner2.jpg';
import bannerb from '../../../assets/work/banner3.jpg';
import banner4 from '../../../assets/work/banner6.jpg';
import styles from './zzgx.less';

const Item = List.Item;
const Brief = Item.Brief;

class zzgx extends React.Component {
  constructor(props) {
    super(props);
    this.state = {}
  }
  apply = (event) => {
    this.props.dispatch(
      routerRedux.push({
        pathname: "/work/zzgx/applytransfer",
        query: {}
      })
    )
  };
  history = () => {
    this.props.dispatch(
      routerRedux.push({
        pathname: "/work/zzgx/applyhistory",
        query: {},
      })
    )
  };
  render() {
    let newsObject = sessionStorage.getItem('userdata');
    newsObject = JSON.parse(newsObject);
    if(!newsObject){
      this.props.dispatch(
        routerRedux.push({
          pathname: "/login",
        })
      )
    }
    return (
      <div>
        <div style={{marginBottom: '0.2rem'}}>
          <img src={bannerb} style={{width: '100%', height: '4rem'}}/></div>
        <WhiteSpace size="lg"/>
        <List className="my-list">
          {
            console.log("orgs",newsObject)
          }
          <Item align="top" thumb={newsObject[0].administrator[4].avatar ? newsObject[0].administrator[4].avatar : banner4}
                multipleLine>{newsObject[0].administrator[1].username}<Brief>{newsObject[0].administrator[2].realname}</Brief>
          </Item>
          <div style={{height: '2rem', marginTop: '0.4rem', marginLeft: '0.3rem'}}>
            <div style={{width: '25%', display: 'inline-block', verticalAlign: 'top'}}>所属组织</div>
            <div style={{width: '75%', display: 'inline-block', color: '#6B6B6B'}}>
              {newsObject[1].orgs[0][2].org_name}
            </div>
          </div>
        </List>
        <WhiteSpace size="lg"/>
        <WhiteSpace size="lg"/>
        <WhiteSpace size="lg"/>
        <Button style={{width: '80%', marginLeft: '0.65rem', backgroundColor: '#DF3031', color: '#ffffff'}}
                onClick={this.apply}
        > 申请关系转接</Button>
        <WhiteSpace size="lg"/>
        <div style={{color: '#AAAAAA', width: '100%', textAlign: 'center'}} onClick={this.history}>查看转接历史</div>
      </div>
    )
  }
}
function mapStateToProps({dangyuanlists}) {
  return {

  }
}
export default connect(mapStateToProps)(zzgx);
